.class public Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;
.super Ljava/lang/Object;
.source "NotificationIconBuilder.java"


# static fields
.field public static final TAG:Ljava/lang/String; = "NotificationIconBuilder"


# instance fields
.field protected mContext:Landroid/content/Context;


# direct methods
.method private constructor <init>(Landroid/content/Context;)V
    .locals 0

    .line 51
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 52
    iput-object p1, p0, Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;->mContext:Landroid/content/Context;

    return-void
.end method

.method public static resizeToNotificationLargeIconSize(Landroid/content/Context;Landroid/graphics/Bitmap;)Landroid/graphics/Bitmap;
    .locals 1

    if-eqz p1, :cond_2

    .line 195
    invoke-virtual {p1}, Landroid/graphics/Bitmap;->isRecycled()Z

    move-result v0

    if-eqz v0, :cond_0

    goto :goto_0

    :cond_0
    const/16 v0, 0x40

    .line 204
    invoke-static {p0, v0}, Llt/farmis/libraries/notificationcontroller/utilities/general/ScreenHelper;->dpToPx(Landroid/content/Context;I)F

    move-result p0

    invoke-static {p0}, Ljava/lang/Math;->round(F)I

    move-result p0

    .line 207
    invoke-virtual {p1}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v0

    if-ne v0, p0, :cond_1

    invoke-virtual {p1}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v0

    if-ne v0, p0, :cond_1

    .line 208
    sget-object p0, Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;->TAG:Ljava/lang/String;

    const-string v0, "No resizing is needed - return the original Bitmap unchanged..."

    invoke-static {p0, v0}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    return-object p1

    :cond_1
    const/4 v0, 0x1

    .line 215
    invoke-static {p1, p0, p0, v0}, Landroid/graphics/Bitmap;->createScaledBitmap(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;

    move-result-object p0

    return-object p0

    .line 196
    :cond_2
    :goto_0
    sget-object p0, Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;->TAG:Ljava/lang/String;

    const-string v0, "Bitmap is invalid or recycled. Return the specified Bitmap instead of throwing an error..."

    invoke-static {p0, v0}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I

    return-object p1
.end method

.method public static with(Landroid/content/Context;)Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;
    .locals 1

    .line 71
    new-instance v0, Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;

    invoke-direct {v0, p0}, Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;-><init>(Landroid/content/Context;)V

    return-object v0
.end method


# virtual methods
.method public varargs buildLargeIcon([Landroid/graphics/drawable/Drawable;)Landroid/graphics/Bitmap;
    .locals 1

    if-eqz p1, :cond_0

    .line 168
    array-length v0, p1

    if-lez v0, :cond_0

    .line 173
    new-instance v0, Landroid/graphics/drawable/LayerDrawable;

    invoke-direct {v0, p1}, Landroid/graphics/drawable/LayerDrawable;-><init>([Landroid/graphics/drawable/Drawable;)V

    .line 176
    iget-object p1, p0, Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;->mContext:Landroid/content/Context;

    invoke-static {v0}, Llt/farmis/libraries/notificationcontroller/utilities/general/BitmapUtils;->convertToBitmap(Landroid/graphics/drawable/Drawable;)Landroid/graphics/Bitmap;

    move-result-object v0

    invoke-static {p1, v0}, Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;->resizeToNotificationLargeIconSize(Landroid/content/Context;Landroid/graphics/Bitmap;)Landroid/graphics/Bitmap;

    move-result-object p1

    return-object p1

    .line 169
    :cond_0
    new-instance p1, Ljava/security/InvalidParameterException;

    const-string v0, "No Drawables provided..."

    invoke-direct {p1, v0}, Ljava/security/InvalidParameterException;-><init>(Ljava/lang/String;)V

    throw p1
.end method

.method public varargs buildLargeIconWithBackground(I[I)Landroid/graphics/Bitmap;
    .locals 4

    if-eqz p2, :cond_1

    .line 117
    array-length v0, p2

    if-lez v0, :cond_1

    .line 122
    array-length v0, p2

    new-array v0, v0, [Landroid/graphics/drawable/Drawable;

    const/4 v1, 0x0

    .line 123
    :goto_0
    array-length v2, p2

    if-ge v1, v2, :cond_0

    .line 124
    iget-object v2, p0, Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;->mContext:Landroid/content/Context;

    aget v3, p2, v1

    invoke-static {v2, v3}, Landroidx/core/content/ContextCompat;->getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;

    move-result-object v2

    aput-object v2, v0, v1

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 128
    :cond_0
    invoke-virtual {p0, p1, v0}, Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;->buildLargeIconWithBackground(I[Landroid/graphics/drawable/Drawable;)Landroid/graphics/Bitmap;

    move-result-object p1

    return-object p1

    .line 118
    :cond_1
    new-instance p1, Ljava/security/InvalidParameterException;

    const-string p2, "No Drawable resource ID\'s provided..."

    invoke-direct {p1, p2}, Ljava/security/InvalidParameterException;-><init>(Ljava/lang/String;)V

    goto :goto_2

    :goto_1
    throw p1

    :goto_2
    goto :goto_1
.end method

.method public varargs buildLargeIconWithBackground(I[Landroid/graphics/drawable/Drawable;)Landroid/graphics/Bitmap;
    .locals 1

    if-eqz p2, :cond_0

    .line 144
    array-length v0, p2

    if-lez v0, :cond_0

    .line 149
    new-instance v0, Landroid/graphics/drawable/ColorDrawable;

    invoke-direct {v0, p1}, Landroid/graphics/drawable/ColorDrawable;-><init>(I)V

    const/4 p1, 0x0

    .line 150
    invoke-static {p2, p1, v0}, Llt/farmis/libraries/notificationcontroller/utilities/general/ArrayUtils;->add([Ljava/lang/Object;ILjava/lang/Object;)[Ljava/lang/Object;

    move-result-object p1

    check-cast p1, [Landroid/graphics/drawable/Drawable;

    .line 153
    invoke-virtual {p0, p1}, Llt/farmis/libraries/notificationcontroller/utilities/NotificationIconBuilder;->buildLargeIcon([Landroid/graphics/drawable/Drawable;)Landroid/graphics/Bitmap;

    move-result-object p1

    return-object p1

    .line 145
    :cond_0
    new-instance p1, Ljava/security/InvalidParameterException;

    const-string p2, "No Drawables provided..."

    invoke-direct {p1, p2}, Ljava/security/InvalidParameterException;-><init>(Ljava/lang/String;)V

    throw p1
.end method
